<#assign contextPath=springMacroRequestContext.getContextPath() />
<#import "/public/frame/main.html" as frame />
<@frame.head "南航明珠商城-商品列表">
</@frame.head>
<link rel="stylesheet" type="text/css" href="${contextPath}/resources/css/search_table.css" />
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 后台管理中心 <span class="c-gray en">&gt;</span>特约商户 <span class="c-gray en">&gt;</span> 商户管理 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
<form method="post" name="query_crud_form"  id="query_crud_form" action="${contextPath}/crud/crud_list" >    
   <input type="hidden" name="page" value="${pagination.pageNo}"  id="page" />                          
    <div class="text-c">
        <table class="table search_table">
           <tr>  
           <td>商户名称：</td>
           <td>
           <input type="text" class="input-text  radius" style="width:250px" placeholder="商户名称" id="crudName" name="crudName" value="${crudQo.crudName}" >
           </td>

            <td>     商户类别：</td>
            <td> 
	           <span class="select-box radius">
	           <select class="select"  name="crudType" id="crudType">
	           	<option value>全部</option>
				<#list typeMap?keys as testKey>
				<#if testKey=crudQo.crudType>
				<option value="${testKey}" selected="selected">${typeMap[testKey]}</option>
				<#else>
				<option value="${testKey}" >              	${typeMap[testKey]}
     			</option>
				</#if>
				
				</#list>
	           </select>
	           </span>
			</td>

                     </tr>
        <tr>
           <td>关键字：</td>
           <td>
                 <input type="text" class="input-text  radius" style="width:250px" placeholder="关键字" id="crudKeyWord" name="crudKeyWord" value="${crudQo.crudKeyWord}" >
           </td>
         <td colspan="6" style="text-align:center;" >
           <input class="btn btn-success radius" type="button"  onclick="search();"  value="搜索" />
           
             </td>
         </tr>
      </table>
    </div>
</form>

    <div class="cl pd-5 bg-1 bk-gray mt-20"> 
      <span class="l">
     <a href="javascript:;" onclick="add()" class="btn btn-primary radius"> 新增</a> 
    </span>
    
    <span class="r">共有数据：<strong> ${pagination.totalCount} </strong> 条</span> </div>
    <table class="table table-border table-bordered table-bg">
        <thead>
        
        <tr   class="text-c">
            <!-- <th width="45px">
            <input  type="checkbox" id="selectAll" disabled="disabled" onclick="checkAll()"/>
            </th> -->
            <th  > 商户名称</th>
            <th >商户类别</th>
            <th >创建时间</th>
            <th width="100" >操作</th>
        </tr>
        </thead>
        <tbody>
       <#if pagination.list?? && (pagination.list?size &gt; 0) >
        <#list pagination.list as crud> 
        	 <tr>
        	   	<td >${crud.name} </td>
        	   	<td >  
        	   	${crud.crudType}
        	   </td>
        	   <td >  ${(crud.createDate?string("yyyy-MM-dd HH:mm:ss"))!}

        	   </td>
 			 	<td>
 			 	 <a href="javascript:view('${crud.id}')"  ><font color="blue">查看</font></a>
 			 	 <a href="javascript:edit('${crud.id}')"  ><font color="blue">修改</font></a>
 			 	 <a href="javascript:deletecrud('${crud.id}')"  ><font color="blue">删除</font></a>
 			 	</td>
        	 </tr>
      </#list></#if>
     </tbody>
    </table>
    <div id="biuuu_city" style="padding-top: 10px;float: right"></div>
</div>
<@frame.end "default">
</@frame.end>

<script type="text/javascript" src="${contextPath}/resources/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="${contextPath}/resources/js/laypage/laypage.js"></script>
<script type="text/javascript" src="${contextPath}/resources/js/order/search_order_list.js"></script>
<script type="text/javascript">
var path="${contextPath}";
laypage({
    cont: 'biuuu_city',//容器。值支持id名、原生dom对象，jquery对象。
    pages: ${pagination.totalPage},//通过后台拿到的总页数
    curr:  ${pagination.pageNo} || 1, //当前页
    skip: true, //是否开启跳页
	first: 1, //将首页显示为数字1,。若不显示，设置false即可
	last: ${pagination.totalPage}, //将尾页显示为总页数。若不显示，设置false即可
    jump: function(obj , first){//触发分页后的回调
        if(!first){ //点击跳页触发函数;当前页为obj.curr
          $(page).val(obj.curr);//获取点击的页码
          $(query_crud_form).submit();
        }
    }
})  
function search(){
    $("#page").val("1");
    $("#query_crud_form").attr("action",path+"/crud/crud_list").submit();
}	
function add(){
	layer_show('添加商户',path+'/crud/crud_toadd', document.body.clientWidth > 900 ? 900 : dcument.body.clientWidth , document.body.clientHeight);
}
function view(id){
	layer_show('查看商户',path+'/crud/crud_toview?id='+id, document.body.clientWidth > 900 ? 900 : dcument.body.clientWidth , document.body.clientHeight);
}
function edit(id){
	layer_show('商户编辑',path+'/crud/crud_toedit?id='+id,document.body.clientWidth > 900 ? 900 : dcument.body.clientWidth , document.body.clientHeight);
}
function deletecrud(id){
	if(confirm("确定删除吗")){
		var url = path+"/crud/crud_delete";
		   $.ajax({
			   url : url,
		   	   type : "post",
		   	   dataType : "text",
		   	   data : {"id":id},
		   	   success : function(msg){
		   		  if(msg=="success"){
	                    layer.msg('删除成功!',{icon:1,time:1000},function(){
	                        window.location.reload();
	                    });
/* 		   			  alert("删除成功！");
		   			  reload(); */
		   		  }else{
		   			layer.alert("删除失败！");
		   		  }
		   	  },
			  error : function(){
				  layer.alert("操作失败");
			  }
		   });
	   }
}
</script>
</body>

</html>
 
